home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
yerk
/
mps231ss.hqx
/
Mops source
/
Toolbox classes
/
Menu
< prev
next >
Wrap
Text File
|
1993-02-06
|
2KB
|
67 lines
\ Menu class.
\ Sept 90 mrh item# anomalies fixed
from MENUMOD import{ MENU APPLEMENU EDITMENU }
compile: MenuMod
true setInstall: MenuMod
: DODSK \ ( item# -- item# ) Executes the desk accessory for an item.
dup openDesk: [self] ;
: MSELECT \ ( point -- item# menuID ) Calls menu manager to track a menu selection
0 swap call MenuSelect unpack swap 1- swap ;
:class MBAR super{ object }
24 ordered-col IDs
24 array MENUS \ array of menu objects
:m DRAW: call DrawMenuBar ;m
:m CLEAR: call ClearMenuBar clear: IDs ;m
:m ADD: \ ( men1 ... menN N -- ) Adds menu objects to the MenuBar object.
0 DO i to: menus i at: menus id: ** add: ids LOOP ;m
:m NEW: \ Inserts menus in Toolbox MenuBar list.
size: IDs 0
do size: IDs 1- i - at: menus insert: ** loop
draw: self ;m
:m INIT: \ ( men1 ... menN N -- )
clear: self add: self new: self ;m
:m EXEC: \ ( item# MenuID -- )
dup 0>
IF indexOf: IDs IF at: menus exec: ** THEN
ELSE 2drop
THEN ;m
:m CLICK: where: fevent mSelect exec: self ;m
:m KEY: \ ( c -- ) Handles a possible menu key selection
0 swap makeint call MenuKey unpack swap 1- swap
exec: self ;m
:m ENABLE: \ Enables all menus in the Menu Bar
size: IDs 0
DO i at: menus handle: ** word0 call EnableItem LOOP
draw: self ;m
:m DISABLE:
size: IDs 0
DO i at: menus handle: ** word0 call DisableItem LOOP
draw: self ;m
;class
mBar MENUBAR \ Our default menu bar
menubar put: MBaddr \ Set as current menu bar